package vn.bus.models;

import java.sql.Connection;
import java.util.ArrayList;

import vn.bus.dao.Database;
import vn.bus.dao.ConnectionDAO;
import vn.bus.dto.ConnectionDTO;

public class ConnectionManager {

	public ArrayList<ConnectionDTO> getAllConnections()throws Exception {
		ArrayList<ConnectionDTO> allConns = null;
		try {
			    Database database= new Database();
			    Connection connection = database.Get_Connection();
			    ConnectionDAO Conn= new ConnectionDAO();
			    allConns=Conn.getAllConnections(connection);
			    connection.close();
		
		} catch (Exception e) {
			throw e;
		}
		return allConns;
	}
	
	public String updatePolyline(String polyline, String station, String next)throws Exception {
		String rs = "";
		try {
			    Database database= new Database();
			    Connection connection = database.Get_Connection();
			    ConnectionDAO Conn= new ConnectionDAO();
			    rs = Conn.updatePolyline(connection, polyline, station, next);
			    connection.close();
		} catch (Exception e) {
			throw e;
		}
		return rs;
	}
}
